<?php

namespace Database\Factories;

use App\Models\Order;
use App\Models\OrderInfo;
use Illuminate\Database\Eloquent\Factories\Factory;

class OrderInfoFactory extends Factory
{
    /**
     * 定义工厂模型
     * @var string
     */
    protected $model= OrderInfo::class;
    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
        $order_status = OrderFactory::$ORDER_STATUS;
        return [

            //order_id 订单表主键
//            'order_id' => function(){
//                return Order::factory()->create()->id;
//            },
            'order_id' => Order::factory(),
            'order_item_id' => $this->faker->numerify('##################'),//订单项id
            'in_price' => $this->faker->randomFloat(2,10,100),//解析后的订单项价格(速卖通订单的原始金额)
            'in_price_code' => $this->faker->currencyCode,//货币种类
            'product_count' => $this->faker->randomDigitNotNull,//商品数量
            'product_id' => $this->faker->numerify('#########'),//平台产品ID
            'product_price' => $this->faker->randomFloat(2,10,100),//商品单价
            'product_name' => $this->faker->sentence(6,true),//商品名称
            'product_img_url' => $this->faker->imageUrl(640, 480, 'cats', true, 'Faker', true),//商品图片
            'sku_code' => $this->faker->swiftBicNumber,//商品编码
            'order_status' => $this->faker->randomElement($order_status),//PLACE_ORDER_SUCCESS:等待买家付款; IN_CANCEL:买家申请取消; WAIT_SELLER_SEND_GOODS:等待您发货; SELLER_PART_SEND_GOODS:部分发货; WAIT_BUYER_ACCEPT_GOODS:等待买家收货; FUND_PROCESSING:买卖家达成一致，资金处理中； IN_ISSUE:含纠纷中的订单; IN_FROZEN:冻结中的订单; WAIT_SELLER_EXAMINE_MONEY:等待您确认金额; RISK_CONTROL:订单处于风控24小时中，从买家在线支付完成后开始，持续24小时; FINISH:已结束的订单;Unfulfillable无法处理；自建站：fulfilled:已完成，null:未完成,partial:部分完成。restocked:缺货
            'in_order_status' => 1,//内部订单状态
            'in_product_id' => $this->faker->numerify('#####'),//系统产品ID goods主键id
            'sku_attributes' => $this->faker->sentence(3,true),//sku属性   速卖通---product_attributes
            'is_gift' => $this->faker->randomElement([0,1]),//是否赠品
            'sku_id' => $this->faker->numerify('##############'),//商品编码id
        ];
    }
}
